Prepared version 0.5b and various optimizations.