Removed code duplication.