Initial commit.
Removed unused files, refractored it to be simpler.
Further tweaking.