refactored block.java