Updated main() to work professionally