Basic functionality copied over from v1, all working, unit tests not yet added