Many changes, made production-ready.