Port to android; Many small fixes;