Initial attempt on problem 4

XXX: Not working; bug with X <- min