added big try catch blocks to see what the errors are