using ordered hash, refactoring values manipulation