Added try catch support and some code generation improvement
Changed code formatting and optimized imports