Use lists:keyfind and lists:keystore when appropriate