Merge pull request #68 from paulbalogh/v2

Merged from Andrei, fixed conflicts