Refactoring of the javascript library. Added toString methods and created custom Exceptions.