Added curly brackets to if-construct