VID-1271 Simplified code, added docs