tighten up some code