cleand up js code