Rewrote code and put it in src folder

Spent today rewriting the code to look more like it should. Works more
efficiently so far. Not finished. Having some trouble getting things
with different lengths to work out.