Added an implementation of max