refactoring split statement