1. Add minibatch functionality
2. Fix bug (phi is normalized)