removed unnessiary phase variables, commented in memory debugging, data type consistency
comments