javascript and cleanup