Refactoring JS scripts and removing most inline styles