*started check for cycle, feel like this might be a bit messy and difficult for the next step - may refactor this into a better data structure