Removed code repetition.