changed name of method
added some docs and checks