Removed some useless functions and variables, the constraintArea parameter fixed and the memory allocation by malloc is replaced with operator new[]