Hopefully fixed #60 by adding some sorting to templates.