added spiros' code