Adding tests and adjusted calculation

Adding basic qunit tests and fixed error in calculation, plus minor
html&css tweek