works, but need optimizations