Added comments
Added exception classes
Fixed issues