Logout implemented

also fixed bug with DB getting destroyed before script completion
started subscribe class

bug with having to do actions twice to get result