refactor, DOES NOT WORK YET