refactoring: moved if into valueWithKind