added logic behind buttons