working version now running in external app properly, added a bunch more tests