added authorisation, changed lib a bit