Updated logic

Able to showstatus to user. Done some refactoring and formating of
codes.