fix coding style and pass tests