v3: working implementation for printf. not finished yet