cleaned up the if statements and fixed a missing @ on line 145