Fixed linker issues by inlining functions

See http://stackoverflow.com/questions/4600190/have-global-function-definition-in-header-file-and-avoid-duplicated-symbol-link
for details