Improved class logic