removed unneeded nested type
fixed errors with clang
added test