Refactor and rename, making things work as a gem.