Restructure JS