Auth completed and code tidied up