Extracted some methods into some gfx util