Some refactor

1. Define the fucntion decideP in Logic.c
2. Define the function decideChuncks in Logic.c
3. Some rearrangement to debug message and user interface