refactor and file restructure