First version, refresh token function might be broken, not tested yet.