Added three extra checks to not access the database or run through a function.