implemented key config. Its a little complicated but I am happy it is there