Generator Implementation Started and some bug fixes