Added function variable calling and started implementing exception handling