Removed unnecessary and duplicate code.