some trivial changes and optimizations