refactor into separate concerns and maybe files