move drawing to seperate function