bugs and refactoring UI