Added functionality to authenticate user