Refactoring, fixes, etc.