cleanup & optimize