Remove superfluous returns in factory