Fixed all warning and refect the code