refactoring mango.