added object oriented aproach