move center calculation to util.py, remove comments