Added basic inference routines
Minor refactoring
Now runs inference too