Just need to tweak some numbers to get it external

working, as internal  works, also if you can optimise the code using
some for loops I think would work.