added spiros' code
first edit of my code