basic function except obstacle added