Fixed formatting and added comments