compartmentalizing front end js