begin and functions