Rename period_from_anything to period. Cleanup code.