fix moving average for mising data
Clean up forms and JS views a bit.