implemented proper authentication