change function name + refactor code