added authentication
code cleanup