remove unnecessary blocks and constants