js code cleanup