Removed some extra empty lines.
Removed multicatch statements to make system compatible with 1.6
Changed transaction to make code less repetitive and easier to read.