Added some more comments, improved testing