adding support for refresh token and some code improvements.