split init & test parts, and encapsulate them into a class