added comment
deleted duplicate code