Class implementation for easy subclassing