tweaks, performance and bug fixes