performance tweak + tweaks from eprjproject thanks A. Del Regno