cleanup commands handling and parsing