Fixed variable names, added docs.