hopefully found my error in logic