Added function to cleanup params
Added check for config before requireing
Extended the check für the rewrite and redirect. Simplified the output