final version. all buttons functional