Completed the main() function