code simplifications/explanations