Add timeperiod (needs corrections), fix timeperiod view