Update blocks.class.php

Formatting and logic fixes