cleanup/reorg and fix basic auth