small style and optimization changes