consolidate code and add comments