Added exception handling.
Finished main functionalities.
Started tests.
Tested.