Rearrange files

Neaten up repo; move code into files