Added functionality for obatining calling function name and did further modularizations.