Fixed formatting and simplified class hierarchy