modified authorization code
Added PDF function, fixed errors in encoder