alterations based on @tobiasbuehlmann's feedback