split code to procedures