started refactoring optional parameters into options object