Fixed some detected bugs and added new template