add std before max() functions