cleaning up JS file to make more readableand compact