fixed modularised helper functions (I think)