Refactored and optimized some assignments.