Avoid flatten

closes #46