converted #6 over from javascript and committing it