original, badly implemented version