NEW: added code and docs