Added port parameter to generate method