refactored all these problems