Added authorisation changes to application and repo. Bug fixes from some light testing also.