Add doctrine, refactor configurations