refactoring code for royal flush