Tidy up, and added average volume JS function