forward checking code done