Added exception handling, main class.