redoing some problems in python and duplicated a few in javascript