UI improvements. JS refactoring.