     [ >>collection ] dip
     >>objects OP_Insert >>opcode ;
 
-: <mdb-update-msg> ( collection object -- mdb-update-msg )
-    [ mdb-update-msg new ] 2dip
-    [ >>collection ] dip
-    [ [ "_id" ] dip at "_id" H{ } clone [ set-at ] keep >>selector ] keep
-    >>object OP_Update >>opcode ;
+CONSTRUCTOR: mdb-update-msg ( collection object -- mdb-update-msg )
+    dup object>> [ "_id" ] dip at "_id" H{ } clone [ set-at ] keep >>selector 
+    OP_Update >>opcode ;
     
-: <mdb-reply-msg> ( -- mdb-reply-msg )
-    mdb-reply-msg new ; inline
+CONSTRUCTOR: mdb-reply-msg ( -- mdb-reply-msg ) ; inline
 
 GENERIC: write-message ( message -- )
 

{ objects sequence } ;


: <mdb-getmore-msg> ( collection return# -- mdb-getmore-msg )
    [ mdb-getmore-msg new ] 2dip
    [ >>collection ] dip
    >>return# OP_GetMore >>opcode ; inline

: <mdb-delete-msg> ( collection assoc -- mdb-delete-msg )
    [ mdb-delete-msg new ] 2dip
    [ >>collection ] dip
    >>selector OP_Delete >>opcode ; inline

: <mdb-query-msg> ( collection assoc -- mdb-query-msg )
     [ mdb-query-msg new ] 2dip
     [ >>collection ] dip
     >>query OP_Query >>opcode ; inline

GENERIC: <mdb-killcursors-msg> ( object -- mdb-killcursors-msg )



M: integer <mdb-killcursors-msg> ( integer -- mdb-killcursors-msg )
    V{ } clone [ push ] keep <mdb-killcursors-msg> ;

GENERIC# <mdb-insert-msg> 1 ( collection objects -- mdb-insert-msg )

