Some internal cleanup