Format the code. Added an helper function to test a period.