Not working, but most of core code there

First major commit