add more comments
use LoginError exception instead of return nothing
refactor some codes