Gen functions

Can you give this a once over, i remember the last time I made some pretty silly mistakes.
Well we don't have a size argument. Maybe we could add one, but in its current form this definitely doesn't have anything to do with the "size" of the result.