Initial commit, needs to be cleaned up and tested.