updated code to following guidelines