some optimizations.
hw7