Improved gaussian function