Adds a bunch of logic