refacttored to own method