Improving and refactoring synthesis algorithms