optimised a few routines and updated paint call in gentable