Added logic to optimise our nodes