Polished JS code