Authentication improved. Alerts added. Fully using promises.