Re #1152 Adding tests and documentations.