Added object instantiation and try/catch -- very messy code