optimized if() statement for mobile and removed unnecessary comment