Reorganization of the classes + adding custom exceptions and reviewing the javadoc