Moved some code to util functions
Fixed README
Added some documentation