slightly refactoring; work in progress