Added min_max for B functionality, commented some code