wire everything up with functions