first completely working version. negconv and encoding not optimized yet.