jSmart slightly altered for multiple platforms, and cleaned.