refactor && fix code