REfactored the js object