#1 added authentication function