This needs to be tested, specially for non-boolean returns of the first function.