refactored the series alignment/munging so it can be tested
updated with tests