refactored several areas