Reworked solution a little