cleaned up code for configuring optional packages