Added authorisation and fixed bugs

Always "fixed bugs"...