refactor the block class