Made changes as suggested, forgot to remove exit() after testing was complete.