merged 2 similar methods