optimizations, but still broken