rewrote with function syntax