Rewritten second part of script