redo inner workings to suck less
fix bugs and write tests
remove old files