added type and keys
refactored either