Better implementation for fun1'