Fix issue where some stops would fail to display departures

Support the case where an API call returns less than 'count' results
Refactor some of the javascript to be shorter/cleaner