[AM]{refactoring,testing} Added new TestClasses. Code refactoring.