Fixed formatting and updated code structure