solving some warning and reviewing the whole of code.