JS: Code cleaning