Issue #473:
- Refactored code a bit (unchanged behavior normally)
- Removed comments/unused code