Can't create anonymous class with non-default constructor hence this class. Is there a better way?