Replace $keys/$values by dict methods