refactoring row/segment logic
refactored row/segment determination; partial refactor of events