Removed functions no longer used
Removed no longer used code
Converted to C++ inline
Fixed a typo in last commit