Better implementation of issue 36