some speed improvements + other minor changes and fixes. Still working on likelihood