Removed superflous else statement.
Improved dynamic dm by only letting it change by 20 % per iteration and keeping it between max and min limit.