make it actually work with a process
cleanup and remove dead code