Proper allocation of JS