separate parsing of input and api calls into different functions