Refactored some issues