Gen functions

Can you give this a once over, i remember the last time I made some pretty silly mistakes.
Is this needed for anything?