Refactor logic Component

Added meaningful comments and remove magic string/number.