fix bugs, add code style, improve UX