adding code for longtermkey