Fixed bug in last commit, and checked this time with unit tests!
MAJOR UPDATE - changed over to better interface ready for GenericSecuirty Module