draw frame and draw dot functionality