Added function compiling as a way of extending templates, updated tests and README