Refactored constructor for the API module, and added storage of the API secret. Also updated meaning of custom error