code formatted using eclipse fixed