exercise challenge now finished, but there is probably a bit better way to do it