Code clean-up
Added authentication