small tweaks and optimizations