added generator code