refactor codes. modify models