refactor on foolish implementationj