Implements q4
Implements neat solution to q5