Added account authentication and more cleanup