slow, incorrect solution