Fixed some ordering bugs and cyclic dependencies checking
Testing structure