First working version. Does not construct proper authentication hash