call the correct function