define main() before calling it

this fixes #24
Merge pull request #25 from mintar/fix_issue24

define main() before calling it