replaced assign with return for all functions