split the code into 2 parts