Remove redundant logic in individual functions