functional version of the refactor
cleans out unnecessary code
ignore *.pid