remove count variable and add resources array (for better debugging) and remove deprecated parts