updated code to reflect documentation