updated master with functions