Fix condition in command parser loop
Refactor Log