relocated small piece of code