Removed extraneous functions and added implementation.