Fixed some warnings/errors generated by -Wall -Werror -pedantic, added missing functions for completeness