Fork for mangos2, improved functions