Refactoring to gist