Fixed some stuff in the logic
Fixed some stuff in the logic