made function inline to allow use in multiple cpp files