Merged 2 conditionals.
used pointers where possible (2 instances).