added few comments, improved code v0.2