Close newly-opened window after successful auth
Refactored the API and updated README