Refactored, added solve5.