FIX: Put back PR #28 code that dit not get merged for some reason