some cleanup and prepare for text parameter