golang style, formatting and minor code flow tweaks

Changes suggested by golint : https://github.com/golang/lint
- No ALLCAPS in golang, we should use CamelCase
- Symbols starting with capital letter are exported autmatically.
  If symbols are to be exported, they should have comment.
  - renamed a few to start with small case.

- formatted to fit 80 columns

- exit program when error is fatal.

- should defer closing files. defer will make sure to close when
  function ends.

- page++ should be with for, not at bottom

- use control flow statements like break, continue, return to get rid
  of else when possible.
  golang indents with tab of size 8. Getting into else just adds to
  unncessary indent

- used gofmt to format the code