Refactor code reducing duplication.

Clean it up with hint and Wall