define main() before calling it

this fixes #24