Remove code duplication for spawn params

Thanks #codeclimate