Fixed an issue with the gates not updating properly. Should do a major
rewrite of these...