Refactored a bit more.