fixed copy-pasta pointed out by sho-luv, added support for for with if/else, updated templates