move main() to the end