small optimizations/changes