Better class oriented code