first attempt to reorganize code

all "static inline" have been removed to avoid warning when compiling.