js and code cleanup