Corrected code structure issues