Fixed some warning, a memory allocation issue where too much memory is allocated and updated the implementation to take advantage of some clang features.