Scripts refactored