cleaned up code in yield