Compressing the code. Getting rid of redundant lines