working after refactor