implemented some sugestions from nico