Reduced redundancies and commented script