Added new options, new tests and code refactoring