added linear types and manual memory mgnt