cleanup and simplified