refactor really needed...