Added error checking to EntryPoint