Refactor - separate script from java

merge master