draw logic