Tests refactoring

Tests refactoring; Code inspection; General clean up;