Removed code duplication to detect changes