Fixed syntax errors and if statement