refactor. working faster