Merge pull request #2 from rikner/master

first working version
small improvements
refactored by nerdmed and rikner