Move the code to find the RFB console to it's own function and remove duplicated code