Cleaned up version of temporal.py