Fixes #5019 consistent usage of viewtype and also caught something missing deprecation notice
Fixes #4511 updates benwerd's pull request 489
added unit tests for modified viewtype functions
Merge pull request #503 from cash/viewtype

Updates viewtype code