De duplication

Various de-duplication / simplification of scripts