Refactoring

Extract method for caculating block width and height