Initial implementation. Very slow indeed