Fixed comments & added sanity checks