fix require, refactor