tweaked to work better with andoid + iOS together