Replaced horribly inefficient animation code with a much better version using tween.js