Added gaussian.
Minor changes and optimizations.