Yes, I think some refactoring wouldn't hurt...