tested for all blocks, debugged, renamed functions