Some fixes and improvements

This pull request fixes the issues #7, #8, #9 and #10 and makes some more minor improvements