finish begin function