Fixing a couple of bugs and now making it all work smoothly