Added optional user authentication