some basic optimization changes