modulize the code