CHESS: cleaned up code