resolved and condensed some code