I think you really should avoid creating functions inside the library, but I do understand that this particular piece of the library is still not finalized.The reason being is that whenever Curt releases updates, your code will be overwritten and you will have to keep updating your own set of libraries everytime, but I'm pretty sure you know how to merge them.Anyway, on your code, I think you should release the RelayMaskOn to its running state, which is 0 and not invert it.When you invert the mask, you are making the mask becode B01111111, which means turn all relays on except number 8.So, that line should be