(Some more refactoring/cleanup...)