refactor into methods
cleanup some more
use blocks for operation