Reorganized subs so that tmday() is a standalone class