need to fix this logic