optimize code for mobiles