4space tabs used, and addClass moved after if else