Added in code to make the system work as expected