Minor efficiency inprovements

Hi,
I have just go through code and spot some places which I think can be simplified and improved little bit.
Please review and pull.
With best regards
  Hynek Vychodil