Juan Lang : cabinet: Use helper function to remove duplicate code.