added functional logic