added logout and token check