refactored modules; added error handling for http codes