changed the cancel button and code