respace and clean javascript