Added smallest and largest functionality