code formatted using eclipse fixed 2