moved auth and config logic into separate modules