Messed up code for period