Modified to be able to work in 3.x
Merge pull request #20 from AbsoluteMSTR/master

Resolve issues with 3.x