Improved remote url handling and some help functions