disable Debug middleware by default in dev mode, code cleanup