Refactor UI and Enhances exception handling