code revisions for pr 468

- apply conventions
- use optimizations
- fix warnings
- use helper method for cloning options