Add patch type and fix indent
Add patch_main and replace def_method where it is not needed