move some global functions
Refactor saved cards template

Most of the logic is outside of the template now so it’s less daunting
to mess with