started working on it. added some (hopefully) helpful comments