Rather big refactoring of system tests script