Completely refactored.