fixed some issues with writecode, and added unaries
complexified a bit the simple example