state of art, code needs cleaning up