Updated to a more flexible system.