Height calculations refactored, better math, results
Some JS tidying