Rename getHost function and add tests