working but slow version
old problems, new language