general cleanup & adaptation