Split up main() function to frontend/frontend.c