Updated for clarity & bug fixes