First version, does not do very much checking.