Moved function implementions into header file