actually save keys
refactor key code
add basic layout template