Changed function defs to use kwargs (+ increased flexibility)