restructuring backround js