files renaming
movinf functions to a more proper place
organize functions and add some comments
Merge pull request #3 from dsanz/simplify_code

Simplify code