Implements #19 (closed). Implementation is complete but requires still some testing. Please test before merging.