more complex case in , need refactoring