Fixed compiler errors and streamlined code.