Made a mistake with variable namings ('root' instead of 'contents'). Fixed
it.