extracted some helper methods