Began modularizing JS files, adding tests