clean up ugly code.