Changed writeOnCanvas to multiple calls from writting multiple times from the same call.