[sidebar] Added comments, formatted code