factoring, code beautifying, a subfunction in size() (for now it's outcommented)