Add comments and update formatting