fix unsharp filter and some refactoring