Implemented exceptions for setters.
Cleaned up code.