Some refactoring + support for thunder modification