updated clear/reset function to much beter solution