new working version with minor display problems