huge refactor to support chaining