Refactored some aspects.