Clear warnings and refactoring unit tests