Functional build with major code cleanup

First functioning build with cleaned code.