fixed things
implemented find min function
added repetitions