Refactored code into timelines helper.
Added a test class for timeline table helper.