modified for midlet