simplified the code structure and the user interface