Big commit.

Consolidate flt() and sink() into move().  "Don't repeat yourself" wins over clarity.

Use local get() which builds an id_to_index dictionary for use by other functions.

Add support for moving something directly to the bottom.

(Note that there are some known ways to break move().)