Reformatting

Added discovered_resources array, followed some jslint advice.