Adding Authentication and improving functionality