refactoing keys and keylines (wip)