Split codes into functions