working var calc for mosaic