Chao - Fixed and Error proofed

Added try catch blocks, error handling, and fixed bugs