set back the ability to change port based on the sys argv
started to migrate UI related function to ui.js, as well as refactoring the code