Bug fixed.
Small optimizations.