refactor in ruby before other changes