building function at the entrance