Code cleaning and a removing some warnings

Hey Karl,

I started working again on the MQM code, and commited some code clean ups to make the code more readable. Furthermore I fixed a couple of unused variable warnings.

I forgot good git practices (should have done this in a separate branch)
There will be more fixes once I isolte the MQM problems

Gr,
Danny