Reorganice the code