add some preliminary functuons