Optimized code.
Removed unused things.