Add emitting the unit value, improve function definition