Code refactor 1

Please use a TAG for logging purpose.