beginning cleaning up javascript