and refactor this