ported level 2 to more modular format
fixed merge conflict