Refactored code for ukidss
tests not monkeypatched yet but use new code