Project refactor and authentication improvements