refactor to two files.
refactor to two files.
refactor and cleaning