Added error checking + added examples