improved code - gui