Optimised original script