add some logging functionality
make default redirect configurable
some comments for clarity