added extractClass function