added append functionality, key checking functionality