Support for vertical pointing scans and bug fixes

See commit messages.