finished... probably needs refactor