logic working a tad better