split main() func into a separate method, should still work