organized code more and incorporated authentication stuff