First working version, but... still needs optimizations, some good features, and code clean-up.