made more generic use of options for ease of later implementation. Refactoring.