Fixed UI bug and improved coding style.