refactoring mandelUI.js