Removed shadowed variables. Changed where the VBO and element buffer are cleared to ensure they are empty when generating functions are called.