minor mistake correction
some performance tweaks