Sorted out where to put parameters and how to keep their references straight.