Adopted red-black tree implementation from https://github.com/stevej/rustled and improved project structure.