add prior as function parameter; add normalize flag