Removed misplaced and duplicated code