added class authmessage

refactor code to use authmessage where required