First commit. Not fully tested and very much in an alpha state.