adapted to also run on Android