2D templates and some other improvements