move copykeys into own file