reformat code
refactor and move code