Reverted NB UDF to previous state due to errors