Pull request 102 lps 32932

Hey Peter,

Can you review this one.
I changed the code a bit, but think most of it shouldn't really change any logic.

Thanks,

Hugo