start of factoring out keys