tidied up wind except for apply template