finished base code