Added error checking + reporting