split out code