more refactoring done.