Function Open modified to use variable parameters