added predict function; more minor edits