Initial commit, working well, needs testing and some documentation