Added default options and refactoring.