added fuctions to reuse code