Structure dashboard javascript in a way that makes sense