Added error checking
Added trimming to template code
Added simple auto completion