added toast info and refactor code