Cleaned up main method and added switch statement plus loop