Complete configuration function and small fixes