factoring out TimeLine class and general tidy up