Attempting to convert my code to an interrupt