updated code to reflect modern python conventions