Refactored code into different files, write response from request into struct