add support for figuring out whether its the last element of the list or not
start rewrite of mapping code to use templates, rather than bytecode generation
make templates work
cleanup a bunch of dead code