Tinkered around with debugging and avoiding pass-by-reference