finish the bulk of porting work from ios to android