Changed the wrapping to an AMD module. Added all JSDocs.