added authentication from scratch