Removed unnecessary code repetition