Implement expiry, add minor validation, still a lot to do
Use a partial template function