clean up logic