Porting over the Android code