#! refactored, optimized, upgraded to rust 0.11.0