further fixes and additions to assign keys
fixes merge conflicts