Fixed syntactic errors, added delay variable management to Gate