gave up on the macro nonsence. Made a recursive function instead. Alot cleaner and more versatile.