changed functions to simplify use as module
Merge pull request #1 from tiagopasq/master

changed functions to simplify use as module