organizing code and removing unused bits
fixed bug i found in keys; probably some stuff got deprecated since this was made