move helper functions out to common.py
p5,p7,p8: all solved