in middle or refactor, not working