master of science thesis - refactor