fixed live editing
code refactoring