improved class construction