Got logins working.
Exported functions useful for debugging.