added related filea and rewrite some functions
Revert "added related filea and rewrite some functions"

This reverts commit 43a9aea70f49bbdceaba03c29f21d8e91008cde2.
Revert "Revert "added related filea and rewrite some functions""

This reverts commit 4c72220543b73001877c0faecb3a1db95e2e629a.