It looks to me like you can just remove the let and return values(scheme, ...all the other values...) from inside both branches of the if.