Fixed #5: Added helpful exceptions and used custom exception classes