implemented generic way to find max of list.