add some constant and did a few refaction