Updated to reflect recent changes and be more OAuth standard compatible