move some things into utils, clean up things