rewrote most of the code, but can'tseem to get it working
moved everything to submodules to commit easier