Removed redirect debug message
Slightly refactored.