Cleanup and portability