Replaced a few redundent function calls. Minor refactoring.