Removed unnecessary code and duplicated statements #3864