Optimizing code and readme
more comments and cleaning up spec