Fixed some bugs and passed all the testbenches so far.