Added code contributions and suggestions by amv2k9