WIP checkin - refactoring code - 2