fixed flicker issue, needs cleaning up though