Added comments to the code, and refined the UI