Refactor chain so it passes results from function to function
Refactor documents test to use chain (now that it can pass values from test to test)