Refactor test. Fix code style.