cleanup, no hardcoded paths
Added javascript, made file write as javascript