TODO refactoring