added button + handler and minor code improvements