Added option to specify the max number of iterations
Fixed issue #3 again
resolved all warnings