More refactoring, trying to clean things up a bit..