Updated classify to take n as a paramter