Fully working solver!