updated functions to be a little bit simpler