How to create methods that accept a block