refactor to seperate concerns