added clearing functions and checks. prepared for beta