Some refactoring, some cleanup, and some additions for creating issues (incomplete).