move unused code to scratch.cpp
move some code to util.[h|cpp]
progress on layout