Can this logic be merged into the above method too?