Adding a scale option and refactoring so that more of the processing is done in the worker thread