refactored all problems