JS cleanup/improvement