added generator support