first (probably buggy) version