Deleted unused variables
Removed unnecessary if-statement