Minor improvements and new function

Added logout function
No need to pass api url and format every time.