`deparse` refactoring

Based on @kmsquire's gist: https://gist.github.com/kmsquire/7407973