refactor a bit more