- Removed unused and duplicated code.
- Minor fixes.