troubled code for troubleshooting