updated code to fit with current style