Fix the UI and explain some blocks of code