Refactor solution (CC @adriana-rv)