Simplified everything, got back to old algorithm