refactor clear-x code into modules
Merge pull request #345 from segmentio/refactor/clear-x

refactor clear-x code into modules