Some changes

Adding tests and fixing issue with null template