Make redirectPath more configurable via a dynamic function