added method of handling input. it is still kind of clunky