Copy/pasted code is cleaned-up;
Proper methods are used instead of casts;
Most files are reformatted;