fixed switch to use a map O(log n) instead of O(n) and whitespace fix
inlined some declarations in smbuilder.h