Added class and optimized getattr