Refactor code, plus first pass at using CSS animations