More minor refactoring and code tidy up.
Remove IPs from an endpoint when they are removed by the API.
Also, some minor code tidies.
Clean up logic when removing unused IPs.
Merge pull request #25 from Metaswitch/plw

More minor changes and code tidy up