Optimized test, added one test. Fix structure of code.