add cancel button and remove obsolete code